{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7915bd20-feae-4571-9b07-42044f95bf8b",
   "metadata": {},
   "source": [
    "## RFSoC-PYNQ ZCU208 Common Board Setup"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "67336699-b4f9-4b70-b1a9-f14e261bb694",
   "metadata": {},
   "source": [
    "Before starting the notebooks, the ZCU208 board must be configured to enable proper clocking and loopback.\n",
    "This setup configures the CLK104 clock synthesizer board in \"direct injection\" mode.  The synthesizers provide two in-phase 4GHz differential clocks via matched cable pairs to the ZCU208.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d9ec0619-edd0-4a4c-8c45-941a94a6e751",
   "metadata": {},
   "source": [
    "The setup requires additional components that are not included in the standard box.\n",
    "* Eight female-to-female SMA adapters\n",
    "* Eight SMA DC Blocks\n",
    "\n",
    "![AdaptersNeeded](./images/SMA_Adapter_DCblock.jpg)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "9d4fe57f-d55b-43b8-8db4-7d0c16d0cd83",
   "metadata": {},
   "source": [
    "# Wiring the CLK104 Board\n",
    "The CLK104 board's ADC_RFCLK_A and DAC_RFCLK_A differential pairs must be wired to the ZCU208's ADC_223_CLK and DAC_229_CLK SMC ports respectively. Yes, the silkscreen labels are incorrect as we are actually injecting into ADC tile 224 and DAC tile 228 clock inputs.\n",
    "![CLK104](./images/CLK104_direct4GHz.jpg)\n",
    "\n",
    "<div class=\"alert alert-block alert-info\">It is recommended to connect the cables to the ZCU208 board first as there is less clearance to twist on the connectors.</div>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d6de1a52-8008-4589-af69-c1e919177aeb",
   "metadata": {},
   "source": [
    "# Loopback DAC to ADC Connections\n",
    "\n",
    "Connect the Carlisle ganged connector to DAC Vout 228/229 ODD soft-touch pad.\n",
    "![DAC Gang](./images/DAC_lowerTiles01.jpg)\n",
    "\n",
    "Connect the second Carlistle ganged connector to ADC Vin 224/225 ODD soft-touch pad.\n",
    "![ADC Gang](./images/ADCvin_carlisle_off.jpg)\n",
    "\n",
    "Attach the female-to-female SMA adapters to each of the male SMA outputs of the DAC gang.  Then attach a DC Block to each.  Repeat for each connection."
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "31e395bc-76b7-4ba9-b26e-d692948910bc",
   "metadata": {},
   "source": [
    "# Matching Pair to Pair\n",
    "Carefully connect DAC differential pairs to their ADC counterpart.  Wire DAC 228/0 to ADC 224/0, being mindful of the N and P polarity.  Repeat this for all eight wires.\n",
    "\n",
    "When complete, you will have completed the full-bandwidth loopback of the DAC outputs to the ADC inputs of the RFSoC.\n",
    "![FinishedWiring](./images/directConnections_DCblocks.JPG)\n",
    "\n",
    "<div class=\"alert alert-block alert-danger\">Jumper posts J21, J23, J44, J48 have power and ground connections.  While wiring the SMA connections or moving the loopback cabling avoid making contact with them or shield them.</div>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
